package com.yoshino.flyweight;

/**
 * @author yoshino
 **/
public class Client {
    public static void main(String[] args) {
        // 创建一个工厂类
        WebSiteFactory factory = new WebSiteFactory();

        // 以新闻发布的网站
        WebSite webSite1 = factory.getWebSiteCategory("新闻");

        webSite1.use(new User("tom"));

        // 以博客发布的网站
        WebSite webSite2 = factory.getWebSiteCategory("博客");

        webSite2.use(new User("jack"));

        WebSite webSite3 = factory.getWebSiteCategory("博客");

        webSite3.use(new User("king"));

        System.out.println("网站的分类=" + factory.getWebSiteCount());
    }
}
